#include "server.hpp"
#include <stdio.h>
#include <stdlib.h>


// #define LOG(format, ...) fprintf(stdout, "[%s %d] "#format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
// #define LOG(msg) fprintf(stdout, "[%s %d] %s\n", __FILE__, __LINE__, msg)

int main()
{
    /*测试读字符串，读取行*/
    /*测试写字符串， 写buffer*/
    Buffer buf;
    for (int i = 0; i < 300; i++)
    {
        std::string str = "hello world " + std::to_string(i) + "\n";
        buf.WriteStringAndPush(str);
    }

    while (buf.ReadAbleSize() > 0)
    {
        std::string tmp = buf.GetLineAndPop();
        DBG_LOG("%s", tmp.c_str());
    }

/*
    Buffer buf;
    buf.WriteStringAndPush(str);

    Buffer buf1;
    buf1.BufferAndPush(buf);

    std::string tmp;
    tmp = buf1.ReadAsStringAndPop(str.size());
    std::cout << tmp << std::endl;
*/  
    return 0;
}